<!-- 配送条件 -->
<template>
	<d2-container>
		<div slot="header">
			<div>配送条件</div>
		</div>
		<div style="width: 500px;">
			<el-form ref="form"  label-width="150px">
			  <el-form-item label="起送条件(元或份)">
			    <el-input v-model="form.peisong"></el-input>
			  </el-form-item>
			  <el-form-item label="配送费">
			    <el-input  v-model="form.psprice"></el-input>
			  </el-form-item>
			  <el-form-item label="配送条件">
			        <el-radio :label="2" v-model="form.type">商品份数</el-radio>
			        <el-radio :label="1" v-model="form.type">订单金额</el-radio>
			  </el-form-item>
			  <el-form-item label="纬度">
			    <el-input  v-model="form.weidu" :disabled="true"></el-input>
			  </el-form-item>
			  <el-form-item label="经度">
			    <el-input  v-model="form.jingdu" :disabled="true"></el-input>
			  </el-form-item>
			  <el-form-item label="距离(米)">
			    <el-input  v-model="form.juli"></el-input>
			  </el-form-item>
			  <el-form-item>
			    <el-button type="primary" @click="onSumbit">确定</el-button>
			    
			  </el-form-item>
			</el-form>
		</div>
	</d2-container>
</template>

<script>
	import {getDeliveryInfo,postDeliveryUpdate} from '@/api/api'
	export default{
		data(){
			return{
				form:{
					peisong:'',
					psprice:'',
					type:'',
					jingdu:'',
					weidu:'',
					juli:''
				}
			}
		},
		mounted(){
			this.getDelData()
		},
		methods:{
			getDelData(){
				getDeliveryInfo().then(res=>{
					if(res.state==0){
						this.form.peisong=res.data.peisong
						this.form.psprice=res.data.psprice
						this.form.type=res.data.type
						this.form.id=res.data.id
						this.form.jingdu=res.data.jingdu
						this.form.weidu=res.data.weidu
						this.form.juli=res.data.juli
					}
				})
			},
			onSumbit(){
				postDeliveryUpdate(this.form).then(res=>{
					if(res.state==0){
						this.$message.success("提交成功")
						this.getDelData()
					}
				})
			}
		}
	}
</script>

<style>
</style>
